<?php
namespace Tool;
use Think\Controller;

/**
 * 禁止翻墙
 */
class AdminController extends Controller {
	function __construct() {
		parent::__construct();
		$nowac = CONTROLLER_NAME . '-' . ACTION_NAME;
		$yx_ac = 'Manager-login,Manager-verifyImg,Tips-tips';
		if (session('id')==null && strpos($yx_ac, $nowac)===false) {
			$this->redirect('Manager/login');
		}
		$user = D('Manager')->find(session('id'));
		$role_id = $user['role'];
		$role = D('Role')->find($role_id);
		$auth_ac = $role['role_auth_ac'];
		$allow_ac ='Manager-login,Manager-logout,Manager-verifyImg,Index-index,Tips-tips';
		if (strpos($auth_ac, $nowac)===false && strpos($allow_ac, $nowac)===false&&session('name')!='admin') {
			exit($this->display('Tips/error'));
		}
	}
}